package groovy

import com.google.common.collect.Maps
import com.jayway.jsonpath.JsonPath;

def static choose() {
    Map<String,Object> request = new HashMap<>();
    request.putIfAbsent("body", "{}");
    Map<String, Object> node = new HashMap<>();
    def header = request.get("header");
    def parameter = request.get("parameter");
    def body = request.get("body");
    node.put("VERSION", "1.0.1");

    def match = "false";
    try{
        if (JsonPath.parse(body).read("\$.gray") == "true") {
            match = "true";
        }
    }catch(Exception e){
        e.printStackTrace()
    }
    node.put("match", match);
    println node
    return node;
}

